<template>
	<div class="goods2_list clearfix">
		<router-link :to="'/Details?id='+item.id" class="fl" v-for="item,index in allgoods" v-if="allgoods">
			<div class="img_square">
				<img v-lazy="$url+item.g_picture">
			</div>
			<div class="g_info">
				<div class="g_name">
				{{item.g_name}}
				</div>
				<div class="g_price">
					<span class="s1">￥{{item.g_price}}</span>
					<span class="s2">￥{{item.g_mprice}}</span>
				</div>
				<div class="g_sales">
					已售出100件
				</div>
			</div>
		</router-link>
	</div>
</template>

<script>
	export default{
		data(){
			return {
				allgoods:[],
			}
		},
		async mounted() {
			let goods = await this.$http.get('goods/goods')
			// console.log(goods)
			this.allgoods=goods.data.data
		}
		
	}
</script>

<style scoped="scoped">
	.goods2_list {
		margin-top: 8.75rem;
		position: relative;
		z-index: 0;
	}

	.goods2_list a {
		position: relative;
		margin-left: 2%;
		width: 47%;
		padding: 0;
		padding-bottom: 0.6rem;
		background-color: #fff;
		margin-top: 16px;
		border-radius: 8px 8px;
	}

	.goods2_list a .g_info {
		padding: 0px 4px;
	}

	.g_info .g_name {
		font-size: 0.875rem;
		color: #6E6E6E;
		line-height: normal;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.g_info .g_price .s1 {
		font-size: 0.875rem;
		color: #FF3303;
	}

	.g_info .g_price .s2 {
		font-size: 0.75rem;
		color: #6E6E6E;
		text-decoration: line-through;
	}

	.g_info .g_sales {
		font-size: 0.75rem;
		color: #6E6E6E;
	}
</style>
